// 继承的作用
class Person{
  String head='头';

  String breath='呼吸';

  num? money;
  Person(this.money);

  sayHi(){
    print('👍🏻👍🏻👍🏻👍🏻');
  }
}

// 适合用在 继承以外的场景
mixin RunMixin{
  run(){
    print('小步快跑');
  }
}

mixin BagMixin{
  String? books;
  setBook(String books){
    this.books=books;
  }
}

class Student extends Person with RunMixin,BagMixin{
  // 子类需要 重写构造函数 传递初始值给父类
  Student(super.money);
}

class Cooker extends Person{
  Cooker(super.money);
}

void main(){
  final s = Student(1);
  print(s.breath);
  print(s.head);
  s.sayHi();
  print(s.money);

  s.run();

  s.setBook('语文书');
  print(s.books);

}